package com.yx.musicplayer.ui.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.yx.musicplayer.ui.fragment.MusicFragment;

/**
 * Created by Administrator on 2017/11/1 0001.
 */

public class VpAdapter extends FragmentPagerAdapter {
    String tabTitles[];

    public VpAdapter(String[] tabTitles, FragmentManager supportFragmentManager) {
        super(supportFragmentManager);
        this.tabTitles = tabTitles;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabTitles[position];
    }

    @Override
    public Fragment getItem(int position) {
        return MusicFragment.newInstance(position);
    }

    @Override
    public int getCount() {
        return tabTitles.length;
    }
}
